package priv.bestbeat.cloud.user.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import priv.bestbeat.cloud.common.dto.RBACUserDTO;
import priv.bestbeat.cloud.user.service.UserService;

/**
 * 用户控制器
 * @author 张渠钦
 * @date 2021/12/9 9:52
 */
@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 根据指定用户名获取用户信息
     * @param username
     * @return
     */
    @GetMapping("/{username}")
    public ResponseEntity<RBACUserDTO> login(@PathVariable("username") String username) {
        RBACUserDTO rbacUserDTO = userService.getRBACUserByUsername(username);
        return ResponseEntity.ok(rbacUserDTO);
    }

}
